/*
 * OpenParts
 * A dynamic-loading components framework for GWT
 * Copyright (C) 2011 Christophe Bouthier  [chris{AT}binary-gastronome{DOT}fr]
 *
 * This work is partially based on work I have done at INRIA (http://www.inria.fr) 
 * in the context of the Qualipso European Project (http://qualipso.org/),
 * The work done at INRIA is Copyright (C) 2006-2011 INRIA
 *
 * This work is distributed under the LGPL version 3
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation. See the GNU
 * Lesser General Public License in LGPL.txt for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package fr.openparts.OpenParts.test.gwt.tests;

import com.google.gwt.junit.client.GWTTestCase;

import fr.openparts.OpenParts.client.OPBinding;
import fr.openparts.OpenParts.client.OPShell;

/**
 * GWT tests for the OPBinding singleton of OPShell. 
 * 
 * @author Christophe Bouthier [chris{AT}binary-gastronome{DOT}fr]
 * @creation.date 16 December 2009
 */
public class OPShellBindingSingletonTestGwt extends GWTTestCase {

    /**
     * Return the name of the tested GWT Module.
     * 
     * @see com.google.gwt.junit.client.GWTTestCase#getModuleName()
     */
    @Override
    public final String getModuleName() {
        return "fr.openparts.OpenParts.test.gwt.TestOpenParts";
    }

    /**
     * Test getting the OPBinding. Shouldn't get null.
     */
    public final void testGettingBinding() {
        assertNotNull("The binding shouldn't be null", OPShell.opBindingSharedInstance());
    }

    /**
     * Test that the shared instance is really a shared instance. Should get the same instance when calling it twice.
     */
    public final void testBindingSharedInstance() {
        final OPBinding binding = OPShell.opBindingSharedInstance();
        assertEquals("The shared instance should be the same at each call", binding, OPShell.opBindingSharedInstance());
    }
}
